<template>  <div>
  <span style="font-size: 20px">模组&料号信息</span>
  <hr style="opacity: 0.3"><br>
  <div style="width: 100%">
    <el-col span="12">
      <el-table
        size="mini"
        style="width: 95%"
        border
        stripe
        :data="tableData1">
        <el-table-column
          prop="model"
          header-align="center"
          align="center"
          label="模组">
        </el-table-column>
      </el-table>
    </el-col>
    <el-col span="12">
      <el-table
        size="mini"
        style="width: 95%"
        stripe
        border
        :data="tableData2">
        <el-table-column
          prop="partNo"
          header-align="center"
          align="center"
          label="料号">
        </el-table-column>
      </el-table>
    </el-col>

  </div>
</div>
</template>
<script>
export default {
  data() {
    return {
      dataForm: {
        key: ''
      },
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      dataListSelections: [],
      // addOrUpdateVisible: false,
      tableData1: [],
      tableData2: []
    }
  },

  activated() {
    this.getDataList()
  },
  methods: {
    // 获取数据列表
    getDataList() {
      this.dataListLoading = true
      this.$http({
        url: 'http://localhost:10000/gongjiajumain/jigmodel/list',
        method: 'get',
        params: this.$http.adornParams({
          'page': this.pageIndex,
          'limit': this.pageSize,
          'key': this.dataForm.key
        })
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.tableData1 = data.page.list
          this.totalPage = data.page.totalCount
        } else {
          this.dataList = []
          this.totalPage = 0
        }
        // this.dataListLoading = false
      })
      this.$http({
        url: 'http://localhost:10000/gongjiajumain/jigpartno/list',
        method: 'get',
        params: this.$http.adornParams({
          'page': this.pageIndex,
          'limit': this.pageSize,
          'key': this.dataForm.key
        })
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.tableData2 = data.page.list
          this.totalPage = data.page.totalCount
        } else {
          this.dataList = []
          this.totalPage = 0
        }
        this.dataListLoading = false
      })

    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
    }
    // 多选
    // selectionChangeHandle(val) {
    //   this.dataListSelections = val
    // },
    // 新增 / 修改
    // addOrUpdateHandle(id) {
    //   this.addOrUpdateVisible = true
    //   this.$nextTick(() => {
    //     this.$refs.addOrUpdate.init(id)
    //   })
    // },
    // 删除
  //   deleteHandle(id) {
  //     var ids = id ? [id] : this.dataListSelections.map(item => {
  //       return item.id
  //     })
  //     this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  //       confirmButtonText: '确定',
  //       cancelButtonText: '取消',
  //       type: 'warning'
  //     }).then(() => {
  //       this.$http({
  //         url: 'http://localhost:10000/gongjiajumain/jigmodel/delete',
  //         method: 'post',
  //         data: this.$http.adornData(ids, false)
  //       }).then(({data}) => {
  //         if (data && data.code === 0) {
  //           this.$message({
  //             message: '操作成功',
  //             type: 'success',
  //             duration: 1500,
  //             onClose: () => {
  //               this.getDataList()
  //             }
  //           })
  //         } else {
  //           this.$message.error(data.msg)
  //         }
  //       })
  //     })
  //   }
  }
}
</script>
